package com.atgm.mall.gmmailmember.controller;

import com.atgm.common.utils.R;
import com.atgm.mall.gmmailmember.service.MemberThumbsCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("gmmallmember/membercommentthumbs")
public class MemberThumbsCommentController {

    @Autowired
    private MemberThumbsCommentService memberCommentThumbsService;

    /**
     * 修改评论点赞数量
     * @param commentId
     * @param memberId
     * @return
     */
    @GetMapping("/updateCommentThumbs/{commentId}/{memberId}")
    public R addCommentThumbs(@PathVariable("commentId") Long commentId, @PathVariable("memberId") Long memberId) {
        Integer flag = memberCommentThumbsService.updateCommentThumbs(commentId, memberId);
        return R.ok().setData(flag);
    }

    /**
     * 用户点赞的评论
     * @param memberId
     * @return
     */
    @GetMapping("/haveCommentThumbs/{memberId}")
    public R haveCommentThumbs(@PathVariable("memberId") Long memberId) {
        List<Long> list = memberCommentThumbsService.haveCommentThumbsId(memberId);
        return R.ok().setData(list);
    }

}
